package com.hoyue.service;

import com.hoyue.bean.Department;
import com.hoyue.bean.WorkDisplay;
import com.hoyue.dao.DepartmentDao;
import com.hoyue.dao.WorkDisplayDao;
import com.hoyue.dao.impl.DepartmentDaoImpl;
import com.hoyue.dao.impl.WorkDisplayDaoImpl;
import com.hoyue.utils.Page;

import java.sql.SQLException;
import java.util.List;

public class WorkDisplayService {
	WorkDisplayDao workDisplayDao = new WorkDisplayDaoImpl();

	public void update(WorkDisplay workDisplay) {
		try {
			workDisplayDao.update(workDisplay);
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public List<WorkDisplay> getAllList() {
		try {
			return workDisplayDao.getAllList();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

	public void addWorkDisplay(WorkDisplay workDisplay) {
		try {
			workDisplayDao.addWorkDisplay(workDisplay);
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public void deleteWorkDisplay(int id) {
		try {
			workDisplayDao.deleteWorkDisplay(id);
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	public String getPicPathById(int id) {
		try {
			return workDisplayDao.getPicPathById(id);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

	public Page<WorkDisplay> getPage(int page) {
		try {
			return workDisplayDao.getPage(page,"work_display");
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}
}
